from django.db import models
from django.conf import settings
# Create your models here.
class User(models.Model):
    username = models.CharField(verbose_name="用户名", max_length=20, null=True, blank=True)
    password = models.CharField(verbose_name="密码", max_length=32, null=True, blank=True)
    age = models.IntegerField()
    icon = models.CharField(max_length=128)
    category = models.IntegerField()
    def __str__(self):
        return self.username

class Account(models.Model):
    username = models.CharField(verbose_name="用户名", max_length=20, null=True, blank=True)
    password = models.CharField(verbose_name="密码", max_length=32, null=True, blank=True)
    def __str__(self):
        return self.username

from django.db import models

class News(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='编号')
    title = models.CharField(max_length=200, verbose_name='标题')
    content = models.TextField(verbose_name='内容')
    category = models.CharField(max_length=100, verbose_name='分类')
    image = models.ImageField(upload_to='news_images/', verbose_name='图片')
    date = models.DateTimeField(auto_now_add=True, verbose_name='日期')
    publisher = models.CharField(max_length=100, verbose_name='发布人')

    class Meta:
        verbose_name = '新闻'
        verbose_name_plural = '新闻'
        ordering = ['-date']

    def __str__(self):
        return self.title